package a05demo5;

import java.io.File;

public class Test {
    public static void main(String[] args) {
        //D:\vscode\JavaScript
        File f = new File("D:\\vscode\\JavaScript");
        File[] files = f.listFiles();
        int js = 0;
        int txt = 0;
        for (File file : files) {
            if (file.getName().endsWith("。js")) {
                js++;
            }
            if (file.getName().endsWith("。txt")) {
                txt++;
            }
        }
        System.out.println("js" + ":" + js + "个");
        System.out.println("txt" + ":" + txt + "个");
    }
}
